home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / QuickDraw / ClutWind / CLUTSample.r < prev    next >
Encoding:
Text File  |  1992-07-15  |  4.0 KB  |  197 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    CLUTSample
  6. #
  7. #    CLUTSample.r    -    Rez Source
  8. #
  9. #   Loosely based in the sample SAMPLE this program shows
  10. #   how to create a window and display on it the colors of the CLUT
  11. #    associated with the device the window sits on top of.
  12. #
  13. #    Left to the curious reader are some improvements such as, remembering the
  14. #    positions of each open window, so if you use this program to monitor your
  15. #    color tables it will position the windows in the last place you opened them.
  16. #    The treatment of direct devices is kind of 'casual' a better color display may 
  17. #    be appropriate. Last, it may be desireable to change the size of the color
  18. #    rectangles depending on the depth of the color table.
  19.  
  20. #    Check Sample sources for more detailed documentation.
  21.  
  22. #    Copyright © 1990 Apple Computer, Inc.
  23. #    All rights reserved.
  24. */
  25.  
  26. #include "Types.r"
  27.  
  28. #include "CLUTSample.h"
  29.  
  30.  
  31. /* this is a definition for a resource which contains only a rectangle */
  32.  
  33. type 'RECT' {
  34.     rect;
  35. };
  36.  
  37.  
  38. /* we use an MBAR resource to conveniently load all the menus */
  39.  
  40. resource 'MBAR' (rMenuBar, preload) {
  41.     { mApple, mFile };    /* two menus */
  42. };
  43.  
  44.  
  45. resource 'MENU' (mApple, preload) {
  46.     mApple, textMenuProc,
  47.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  48.     enabled, apple,
  49.     {
  50.         "About Sample…",
  51.             noicon, nokey, nomark, plain;
  52.         "-",
  53.             noicon, nokey, nomark, plain
  54.     }
  55. };
  56.  
  57. resource 'MENU' (mFile, preload) {
  58.     mFile, textMenuProc,
  59.     0xFFB,                /* enable items */
  60.     enabled, "File",
  61.     {
  62.         "New",
  63.             noicon, "N", nomark, plain;
  64.         "Close",
  65.             noicon, "W", nomark, plain;
  66.         "-",
  67.             noicon, nokey, nomark, plain;
  68.         "Quit",
  69.             noicon, "Q", nomark, plain
  70.     }
  71. };
  72.  
  73. /* this ALRT and DITL are used as an About screen */
  74.  
  75. resource 'DITL' (128) {
  76.     {    /* array DITLarray: 5 elements */
  77.         /* [1] */
  78.         {88, 180, 108, 260},
  79.         Button {
  80.             enabled,
  81.             "OK"
  82.         },
  83.         /* [2] */
  84.         {8, 8, 24, 214},
  85.         StaticText {
  86.             disabled,
  87.             "Clut Window"
  88.         },
  89.         /* [3] */
  90.         {32, 8, 48, 237},
  91.         StaticText {
  92.             disabled,
  93.             "Copyright © 1990"
  94.         },
  95.         /* [4] */
  96.         {56, 8, 72, 186},
  97.         StaticText {
  98.             disabled,
  99.             "Dennis Hescox- DTS"
  100.         },
  101.         /* [5] */
  102.         {80, 24, 112, 167},
  103.         StaticText {
  104.             disabled,
  105.             ""
  106.         }
  107.     }
  108. };
  109.  
  110. resource 'ALRT' (128) {
  111.     {40, 20, 160, 292},
  112.     128,
  113.     {    /* array: 4 elements */
  114.         /* [1] */
  115.         OK, visible, silent,
  116.         /* [2] */
  117.         OK, visible, silent,
  118.         /* [3] */
  119.         OK, visible, silent,
  120.         /* [4] */
  121.         OK, visible, silent
  122.     }
  123. };
  124.  
  125.  
  126. /* this ALRT and DITL are used as an error screen */
  127.  
  128. resource 'ALRT' (rUserAlert, purgeable) {
  129.     {40, 20, 120, 260},
  130.     rUserAlert,
  131.     { /* array: 4 elements */
  132.         /* [1] */
  133.         OK, visible, silent,
  134.         /* [2] */
  135.         OK, visible, silent,
  136.         /* [3] */
  137.         OK, visible, silent,
  138.         /* [4] */
  139.         OK, visible, silent
  140.     }
  141. };
  142.  
  143.  
  144. resource 'DITL' (rUserAlert, purgeable) {
  145.     { /* array DITLarray: 3 elements */
  146.         /* [1] */
  147.         {50, 150, 70, 230},
  148.         Button {
  149.             enabled,
  150.             "OK"
  151.         },
  152.         /* [2] */
  153.         {10, 60, 30, 230},
  154.         StaticText {
  155.             disabled,
  156.             "CLUTSample - Error occurred!"
  157.         },
  158.         /* [3] */
  159.         {8, 8, 40, 40},
  160.         Icon {
  161.             disabled,
  162.             2
  163.         }
  164.     }
  165. };
  166.  
  167.  
  168. resource 'WIND' (rWindow, preload, purgeable) {
  169.     {358, 570, 422, 634},
  170.     documentProc, visible, noGoAway, 0x0, "CLUT"
  171. };
  172.  
  173.  
  174. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  175.  
  176. resource 'SIZE' (-1) {
  177.     dontSaveScreen,
  178.     acceptSuspendResumeEvents,
  179.     enableOptionSwitch,
  180.     canBackground,                /* we can background; we don't currently, but our sleep value */
  181.                                 /* guarantees we don't hog the Mac while we are in the background */
  182.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  183.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  184.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  185.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  186.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  187.     reserved,
  188.     reserved,
  189.     reserved,
  190.     reserved,
  191.     reserved,
  192.     reserved,
  193.     reserved,
  194.     kPrefSize * 1024,
  195.     kMinSize * 1024    
  196. };
  197.